const inorder = function(root) {
  const ans = []
  if(root !== null) {
    const stack = []
    while(stack.length > 0 || root !== null) {
      if(root !== null) {
        stack.push(root)
        root = root.left
      } else {
        root = stack.pop()
        ans.push(root.val)
        root = root.right
      }
    }
  }
}